package xyz.zhouzhaodong.crm.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import xyz.zhouzhaodong.crm.dto.PayrollDto;
import xyz.zhouzhaodong.crm.entity.Payroll;
import xyz.zhouzhaodong.crm.service.IPayrollService;
import xyz.zhouzhaodong.crm.util.NoRepeatSubmit;
import xyz.zhouzhaodong.crm.util.RestMessage;

import javax.annotation.Resource;

/**
 * <p>
 * 薪资表 前端控制器
 * </p>
 *
 * @author zhouzhaodong
 * @since 2020-06-21
 */
@RestController
@RequestMapping("/payroll")
public class PayrollController {

    @Resource
    IPayrollService payrollService;

    /**
     * 新增薪资
     * @param payroll
     * @return
     */
    @NoRepeatSubmit
    @RequestMapping("/add")
    public RestMessage addPayroll(Payroll payroll){
        return payrollService.addPayroll(payroll);
    }

    /**
     * 删除薪资
     * @param payroll
     * @return
     */
    @RequestMapping("/delete")
    public RestMessage deletePayroll(Payroll payroll){
        return payrollService.deletePayroll(payroll);
    }

    /**
     * 修改薪资
     * @param payroll
     * @return
     */
    @RequestMapping("/update")
    public RestMessage updatePayroll(Payroll payroll){
        return payrollService.updatePayroll(payroll);
    }

    /**
     * 查询薪资
     * @param payrollDto
     * @return
     */
    @RequestMapping("/select")
    public RestMessage selectPayroll(PayrollDto payrollDto){
        return payrollService.selectPayroll(payrollDto);
    }

}
